%macro wordcount(list);
%local count;
%let count=0;
%do %while(%qscan(&list.,&count.+1,%str( )) ne %str() );
 %let count=%eval(&count.+1);
%end;
&count.
%mend wordcount;
